package kr.co.tomatosystem.pde.tools.internal.marker;

import kr.co.tomatosystem.pde.tools.Constants;

import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolutionGenerator;

public class MarkerResolutionGenerator implements IMarkerResolutionGenerator {

	@Override
	public IMarkerResolution[] getResolutions(IMarker marker) {

		try {
			String subKind = (String) marker.getAttribute(Constants.MARKER_SUBKIND);
			if ("config".equals(subKind)) {
				return new IMarkerResolution[] { new ReConfigureSetting() };
			}

			else if ("duplication".equals(subKind)) {
				return new IMarkerResolution[] { new RenameResolution() };
			}

			else {
				return new IMarkerResolution[0];
			}
		} catch (CoreException e) {
			e.printStackTrace();
			return new IMarkerResolution[0];
		}

	}
}
